#pragma once

#include "AlignedMemAlloc.h"


namespace mphys
{
	class RigidBody;

	struct Contact
	{
		RigidBody * Body[2];
		XMFLOAT3A Point; // in world space

		float Penetration;
		float Restitution;

		//struct
		//{
		XMFLOAT3X3 ContactToWorld;
		XMFLOAT3 Normal; // in world space
		XMFLOAT3X3 WorldToContact;

		XMFLOAT3 Velocity; // in contact space
		float DeltaVelocity;
		XMFLOAT3 RelativeContactPosition[2]; // Point of contact relative to body position
		//} Derived;
	};

	class CollisionData
	{
	public:
		CollisionData();
		~CollisionData();

		void reset();
		std::vector<Contact, util::AlignedMemAlloc<Contact, 16> > & getContacts();

	private:
		std::vector<Contact, util::AlignedMemAlloc<Contact, 16> > mContacts;
	};
}